
#ifndef EAGLVIEW_H
#define EAGLVIEW_H

// INCLUDES ********************************************************************

#import "AccelerationDelegate.h"

#import <Foundation/Foundation.h>

#import <UIKit/UIKit.h>

#import <QuartzCore/QuartzCore.h>


// FORWARD DECLARATIONS ********************************************************

@class ESRenderer;

/*******************************************************************************
 
 TODO:  - ES 2.0
        - multisampling
        - handle touch cancelling
 
*******************************************************************************/

// *****************************************************************************

//! EAGLView
//!
// *****************************************************************************

@interface EAGLView : UIView
{
    //! either using OpenGL ES 1.1 or 2.0 features
    ESRenderer* mRenderer;
    
    //! used in iOS 3.1 or higher
    CADisplayLink* mDisplayLink;
    
    //! used in iOS 3.0 or lower
    NSTimer* mRenderTimer;
    
    AccelerationDelegate* mAccelerationDelegate;
    
    //! is the view currently rendering?
    BOOL mRendering;
    
    //! rotation of the view depending on ( static) device orientation
    float mRotation;
    
    //! used to convert touch coordinates to make them match the orientation    
    float mTouchOrientationCompensationY;
}

- ( id)initWithFrame:( CGRect) frame orientation:( UIInterfaceOrientation) orientation andOptions:( NSDictionary*) options;
      
- ( void)adaptOrientation:( UIInterfaceOrientation) orientation;

- ( void)startRendering;

- ( void)stopRendering;

@end

#endif
